<%@ page language="java" pageEncoding="UTF-8"%>
<%@ include file="/pages/commons/path.jsp"%>

<script type="text/javascript">
	function isValid() {
		$('#id').validatebox({
			required : true,
			missingMessage : '请输入有效的编号！'
		});
		if (!$('#id').validatebox('isValid'))
			return false;
		$('#companyId').validatebox({
			required : true,
			missingMessage : '请输入有效的归属公司！'
		});
		if (!$('#companyId').validatebox('isValid'))
			return false;
		$('#officeId').validatebox({
			required : true,
			missingMessage : '请输入有效的归属部门！'
		});
		if (!$('#officeId').validatebox('isValid'))
			return false;
		$('#loginName').validatebox({
			required : true,
			missingMessage : '请输入有效的登录名！'
		});
		if (!$('#loginName').validatebox('isValid'))
			return false;
		$('#password').validatebox({
			required : true,
			missingMessage : '请输入有效的密码！'
		});
		if (!$('#password').validatebox('isValid'))
			return false;
		$('#no').validatebox({
			required : true,
			missingMessage : '请输入有效的工号！'
		});
		if (!$('#no').validatebox('isValid'))
			return false;
		$('#name').validatebox({
			required : true,
			missingMessage : '请输入有效的姓名！'
		});
		if (!$('#name').validatebox('isValid'))
			return false;
		$('#email').validatebox({
			required : true,
			missingMessage : '请输入有效的邮箱！'
		});
		if (!$('#email').validatebox('isValid'))
			return false;
		$('#phone').validatebox({
			required : true,
			missingMessage : '请输入有效的电话！'
		});
		if (!$('#phone').validatebox('isValid'))
			return false;
		$('#mobile').validatebox({
			required : true,
			missingMessage : '请输入有效的手机！'
		});
		if (!$('#mobile').validatebox('isValid'))
			return false;
		$('#userType').validatebox({
			required : true,
			missingMessage : '请输入有效的用户类型！'
		});
		if (!$('#userType').validatebox('isValid'))
			return false;
		$('#loginIp').validatebox({
			required : true,
			missingMessage : '请输入有效的最后登陆IP！'
		});
		if (!$('#loginIp').validatebox('isValid'))
			return false;
		$('#loginDate').validatebox({
			required : true,
			missingMessage : '请输入有效的最后登陆时间！'
		});
		if (!$('#loginDate').validatebox('isValid'))
			return false;
		$('#createBy').validatebox({
			required : true,
			missingMessage : '请输入有效的创建者！'
		});
		if (!$('#createBy').validatebox('isValid'))
			return false;
		$('#createDate').validatebox({
			required : true,
			missingMessage : '请输入有效的创建时间！'
		});
		if (!$('#createDate').validatebox('isValid'))
			return false;
		$('#updateBy').validatebox({
			required : true,
			missingMessage : '请输入有效的更新者！'
		});
		if (!$('#updateBy').validatebox('isValid'))
			return false;
		$('#updateDate').validatebox({
			required : true,
			missingMessage : '请输入有效的更新时间！'
		});
		if (!$('#updateDate').validatebox('isValid'))
			return false;
		$('#remarks').validatebox({
			required : true,
			missingMessage : '请输入有效的备注信息！'
		});
		if (!$('#remarks').validatebox('isValid'))
			return false;
		$('#delFlag').validatebox({
			required : true,
			missingMessage : '请输入有效的删除标记！'
		});
		if (!$('#delFlag').validatebox('isValid'))
			return false;

		return true;
	}

	function save() {
		if (!isValid())
			return;
			var id = $.trim($('#id').val());
			var companyId = $.trim($('#companyId').val());
			var officeId = $.trim($('#officeId').val());
			var loginName = $.trim($('#loginName').val());
			var password = $.trim($('#password').val());
			var no = $.trim($('#no').val());
			var name = $.trim($('#name').val());
			var email = $.trim($('#email').val());
			var phone = $.trim($('#phone').val());
			var mobile = $.trim($('#mobile').val());
			var userType = $.trim($('#userType').val());
			var loginIp = $.trim($('#loginIp').val());
			var loginDate = $.trim($('#loginDate').val());
			var createBy = $.trim($('#createBy').val());
			var createDate = $.trim($('#createDate').val());
			var updateBy = $.trim($('#updateBy').val());
			var updateDate = $.trim($('#updateDate').val());
			var remarks = $.trim($('#remarks').val());
			var delFlag = $.trim($('#delFlag').val());

		$.ajax({
			type : 'post',
			url : '${ctx}/adminManage/sys/sysUser/doUpdate.do',
			data : {
					id : id,
					companyId : companyId,
					officeId : officeId,
					loginName : loginName,
					password : password,
					no : no,
					name : name,
					email : email,
					phone : phone,
					mobile : mobile,
					userType : userType,
					loginIp : loginIp,
					loginDate : loginDate,
					createBy : createBy,
					createDate : createDate,
					updateBy : updateBy,
					updateDate : updateDate,
					remarks : remarks,
					delFlag : delFlag
			},
			dataType : 'json',
			success : function(data) {
				var result = data.result;
				if (result == 'success') {
					$.messager.alert('提示', '操作成功！', 'info');

					$('#editDiv').dialog('close');
					$('#dataTable').treegrid('reload');
					$('#dataTable').treegrid('clearChecked');
				} else {
					$.messager.alert('提示', '操作失败！<br />' + data.error, 'error');
				}
			},
			error : function(XMLHttpRequest, textStatus, errorThrown) {
				$.messager.alert('提示', '操作失败！<br />' + errorThrown, 'error');
			}
		});
	}
	
	function cancel() {
		$('#editDiv').dialog('close');
	}
</script>

<table class="table2">
	<tr>
		<td>编号：</td>
		<td>
			<input id="id" type="text" value="${info.id}" style="width: 200px" />
		</td>
	</tr>
	<tr>
		<td>归属公司：</td>
		<td>
			<input id="companyId" type="text" value="${info.companyId}" style="width: 200px" />
		</td>
	</tr>
	<tr>
		<td>归属部门：</td>
		<td>
			<input id="officeId" type="text" value="${info.officeId}" style="width: 200px" />
		</td>
	</tr>
	<tr>
		<td>登录名：</td>
		<td>
			<input id="loginName" type="text" value="${info.loginName}" style="width: 200px" />
		</td>
	</tr>
	<tr>
		<td>密码：</td>
		<td>
			<input id="password" type="text" value="${info.password}" style="width: 200px" />
		</td>
	</tr>
	<tr>
		<td>工号：</td>
		<td>
			<input id="no" type="text" value="${info.no}" style="width: 200px" />
		</td>
	</tr>
	<tr>
		<td>姓名：</td>
		<td>
			<input id="name" type="text" value="${info.name}" style="width: 200px" />
		</td>
	</tr>
	<tr>
		<td>邮箱：</td>
		<td>
			<input id="email" type="text" value="${info.email}" style="width: 200px" />
		</td>
	</tr>
	<tr>
		<td>电话：</td>
		<td>
			<input id="phone" type="text" value="${info.phone}" style="width: 200px" />
		</td>
	</tr>
	<tr>
		<td>手机：</td>
		<td>
			<input id="mobile" type="text" value="${info.mobile}" style="width: 200px" />
		</td>
	</tr>
	<tr>
		<td>用户类型：</td>
		<td>
			<input id="userType" type="text" value="${info.userType}" style="width: 200px" />
		</td>
	</tr>
	<tr>
		<td>最后登陆IP：</td>
		<td>
			<input id="loginIp" type="text" value="${info.loginIp}" style="width: 200px" />
		</td>
	</tr>
	<tr>
		<td>最后登陆时间：</td>
		<td>
			<input id="loginDate" type="text" value="${info.loginDate}" style="width: 200px" />
		</td>
	</tr>
	<tr>
		<td>创建者：</td>
		<td>
			<input id="createBy" type="text" value="${info.createBy}" style="width: 200px" />
		</td>
	</tr>
	<tr>
		<td>创建时间：</td>
		<td>
			<input id="createDate" type="text" value="${info.createDate}" style="width: 200px" />
		</td>
	</tr>
	<tr>
		<td>更新者：</td>
		<td>
			<input id="updateBy" type="text" value="${info.updateBy}" style="width: 200px" />
		</td>
	</tr>
	<tr>
		<td>更新时间：</td>
		<td>
			<input id="updateDate" type="text" value="${info.updateDate}" style="width: 200px" />
		</td>
	</tr>
	<tr>
		<td>备注信息：</td>
		<td>
			<input id="remarks" type="text" value="${info.remarks}" style="width: 200px" />
		</td>
	</tr>
	<tr>
		<td>删除标记：</td>
		<td>
			<input id="delFlag" type="text" value="${info.delFlag}" style="width: 200px" />
		</td>
	</tr>
	<tr>
		<td colspan="2" align="center">
			<a id="saveButton" class="easyui-linkbutton" icon="icon-ok" onclick="save()">确定</a>
			<a class="easyui-linkbutton" icon="icon-cancel" onclick="cancel()">取消</a>
		</td>
	</tr>
</table>